<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .box {
            width: 100%;
            height: 56px;
            text-align: center;
            color: #fff;
            margin-bottom: 20px;
        }

        .orange{
            background: orange;
        }

        .skyblue{
            background: skyblue;
        }

        .pink{
            background: pink;
        }
    </style>
</head>

<body>
    <div id="app">
        <my-title classes="orange" title="首页"></my-title>

        <my-title classes="skyblue" title="列表"></my-title>

        <my-title classes="pink" title="详情"></my-title>
    </div>

    <!-- 标题组件 -->
    <template id="title">
        <div :class="'box ' + classes">
            <h1>{{ title }}</h1>
        </div>
    </template>

    <script src="./vue.js"></script>
    <script>

        const Title = {
            template: "#title",
            props: ["title", "classes"]
        }

        new Vue({
            el: "#app",
            // 注册组件
            components: {
                "my-title": Title
            }
        })
    </script>
</body>

</html>